/*
day36
2019.10.3
*/
#include<stdio.h>
#include<stdlib.h>

struct ListNode {
    int val;
    struct ListNode *next;
};

bool isPalindrome(struct ListNode* head){
	struct ListNode *fast=head,*slow=head;
	while(fast)
	{
		for(int i=0;i<2&&fast;)
		{
			fast=fast->next;
			i++;
		}
		slow=slow->next;
	}
	
	struct ListNode *res=reverseList(slow);
	struct ListNode *p1=head,p2=res;
	while(p2)
	{
		if(p1->val!=p2->val)
		{
			return false;
		}
		p1=p1->next;
		p2=p2->next;
	}
	return true;
}


struct ListNode* reverseList(struct ListNode* head){
	
	struct ListNode *pre=NULL,*cur=head,*tem;
	while(cur)
	{
		tem=cur->next;
		cur->next=pre;
		pre=cur;
		cur=tem;
	}
	return pre;
}

int main()
{
	return 0;
}
